/**************************************************************************
 * @doc ISODump
 * @module ISODump.C |  
 * Source code for the ISODump handling functions.
 *
 * Product         :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 *
 * @head3 ISODump Functions | 
 * @index | ISODump
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 * 
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form 
 * or by any means whether electronic, mechanical, magnetic, optical, 
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $Log: /SoftPay/SPK2SIM/Source/ISODump/ISODump.c $
 ********************************************************************************/

#ifndef __ISODUMP_H_
#define __ISODUMP_H_

#define	ISODUMP_DATE_SIZE								16
#define	ISODUMP_TIME_SIZE								16
#define	ISODUMP_MAX_RECORDS							32					// Maximum No. of records to be stored in the packet log
#define	ISODUMP_MAX_DATA_SIZE						512					// Maximum expected size of each ISO8583 packet
#define	ISODUMP_LOG_FILE_NAME						"ISODump.log"		// Packet Log file name

typedef struct tag_ISODUMP_LOG_OBJECT
{
	unsigned char szDate[ISODUMP_DATE_SIZE];
	unsigned char szTime[ISODUMP_TIME_SIZE];
	unsigned char szISO8583Data[ISODUMP_MAX_DATA_SIZE];
} ISODUMP_LOG_OBJECT;

#define	ISODUMP_LOG_OBJECT_SIZE						sizeof(ISODUMP_LOG_OBJECT)
#define	ISODUMP_ERROR_MSG_SIZE						64

/* Error Codes */

#define ISODUMP_ERROR_READING_RECORD				-1
#define ISODUMP_ERROR_WRITING_RECORD				-2
#define ISODUMP_ERROR_PRINTING_RECORD				-3
#define ISODUMP_ERROR_DELETING_RECORD				-4
#define ISODUMP_ERROR_CREATING_FILE					-5

/* Message Codes */

#define ISODUMP_FORMFEED_MSG							0
#define ISODUMP_NORECORDS_MSG						1
#define ISODUMP_READFAIL_MSG							2
#define ISODUMP_WRITEFAIL_MSG							3
#define ISODUMP_PRINTFAIL_MSG							4
#define ISODUMP_DELETEFAIL_MSG						5
#define ISODUMP_CREATEFAIL_MSG						6

#endif	/* __ISODUMP_H_ */

/* Function Prototypes */

int inPrintISO8583PacketLog(void);
int inWriteISO8583PacketToLog(unsigned char* szPacket, int inLength);
int inFormatISO8583Packet(unsigned char* szFormattedPacket, unsigned char* szOriginalPacket, int inLength);
int inPrintErrorMessage(int inMessageIndex);

extern void vdFormatDate (char *pchDate);
extern void vdFormatTime (char *pchTime);